/*
 * Топологическая сортировка
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

enum vertex_st {
	VERTEX_ST_UNKNOWN = 0,
	VERTEX_ST_OPEN,
	VERTEX_ST_VISITED
};

/* {{{ autoarray */
struct vector {
	int *data;
	int n;
	int max;
};

void
vector_init(struct vector *v, int p)
{
	if (p < 0)
		p = 0;
	v->max = 1 << p;
	v->n = 0;
	v->data = (int *) calloc((size_t) v->max, sizeof *v->data);
}

int
vector_append(struct vector *v, int a)
{
	int *t;

	if (v->max == 0)
		vector_init(v, 0);

	if (v->n + 1 > v->max) {
		t = (int *) realloc(v->data, sizeof *t * (v->max *= 2));
		if (!t) {
			fprintf(stderr, "vector_append(): failed to allocate %d bytes\n", v->max);
			return 1;
		} else {
			v->data = t;
		}
	}

	v->data[v->n++] = a;

	return 0;
}

int
vector_sort(struct vector *v, int (*cmpf)(const void *, const void *))
{
	if (v->max > 0 && v->n > 1) {
		qsort(v->data, (size_t) v->n, sizeof *v->data, cmpf);
		return 0;
	} else {
		return 1;
	}
}

int
vector_cleanup(struct vector *v)
{
	if (v->max > 0) {
		v->max = v->n = 0;
		free(v->data);
		v->data = NULL;
		return 0;
	} else {
		return 1;
	}
}
/* }}} */

/* {{{ doubly-linked list */
struct dll_node {
	int key;
	struct dll_node *prev, *next;
};

/*
 * This function inserts one node pointed to by 'ins' _after_ 'node'.
 * And it doesn't give a rat's ass about anything else.
 */
struct dll_node *
dll_insert(struct dll_node *node, struct dll_node *ins)
{
	assert(node != NULL);
	if (ins == NULL) {
		fprintf(stderr, "dll_insert(): ins is NULL, not doing anything\n");
		return node;
	}

	if (node->next) {
		assert(node->next->prev == node);
		node->next->prev = ins;
	}
	ins->next = node->next;
	ins->prev = node;
	node->next = ins;
	return ins;
}

/*
 * This function extracts 'node' from a doubly-linked list and returns pointer
 * to that node, which pointers '->prev' and '->next' are not reset.
 *
 * If you really want to get rid of a node, call
 * 	free(dll_delete(unneeded_node));
 */
struct dll_node *
dll_delete(struct dll_node *node)
{
	if (!node) {
		fprintf(stderr, "dll_delete(): received NULL ptr, wtf am i supposed to delete?\n");
		return NULL;
	}
	if (node->prev) {
		assert(node->prev->next == node);
		node->prev->next = node->next;
	}
	if (node->next) {
		assert(node->next->prev == node);
		node->next->prev = node->prev;
	}
	return node;
}
/* }}} */

/* {{{ adjlist w/ doubly-linked list */
struct adjlist_dll {
	struct dll_node *head;
	struct dll_node *tail;
	int _list_len;

	enum vertex_st state;
	int color;
	int distance;
	int prev;
};
/* {{{ functions */
void
adjl_dll_connect(struct adjlist_dll *node, int conid)
{
	struct dll_node *wanderer;

	wanderer = (struct dll_node *) malloc(sizeof *wanderer);
	wanderer->key = conid;
	wanderer->prev = wanderer->next = NULL;

	if (node->head == NULL) {
		assert(node->tail == NULL);
		node->head = node->tail = wanderer;
		node->_list_len = 1;
	} else {
		dll_insert(node->tail, wanderer);
		node->_list_len++;
	}
}

void
adjl_dll_cleanup(struct adjlist_dll *al)
{
	struct dll_node *nx = al->head, *pr = al->head;

	while (nx) {
		pr = nx;
		nx = nx->next;
		free(pr);
	}
	al->_list_len = 0;
}
/* }}} */
/* }}} */

int
dfs_toposort(struct adjlist_dll *al, const int idx, struct vector *lst)
{
	struct dll_node *nd = al[idx].head;
	al[idx].state = VERTEX_ST_OPEN;
	while (nd) {
		if (al[nd->key].state == VERTEX_ST_OPEN)
			return 1;
		if (al[nd->key].state == VERTEX_ST_UNKNOWN
				&& dfs_toposort(al, nd->key, lst) == 1)
			return 1;
		nd = nd->next;
	}
	vector_append(lst, idx);
	al[idx].state = VERTEX_ST_VISITED;
	return 0;
}

int
main(void)
{
	struct adjlist_dll *al;
	static struct vector lst;
	int i, n, m, a, b;

	scanf("%d%d", &n, &m);
	vector_init(&lst, 6);
	al = (adjlist_dll *) calloc(n, sizeof *al);
	for (i = 0; i < m; i++) {
		scanf("%d%d", &a, &b);
		--a, --b;
		adjl_dll_connect(al + a, b);
	}

	for (i = 0; i < n; i++) al[i].state = VERTEX_ST_UNKNOWN;

	for (i = 0; i < n; i++) {
		if (al[i].state == VERTEX_ST_UNKNOWN)
			if (dfs_toposort(al, i, &lst) == 1) {
				puts("-1");
				goto bail;
			}
	}

	for (i = lst.n - 1; i >= 0; i--)
		printf("%d ", lst.data[i] + 1);
	fputc('\n', stdout);

bail:
	for (i = 0; i < n; i++) adjl_dll_cleanup(al + i);
	free(al);
	vector_cleanup(&lst);
	return 0;
}
